home *** CD-ROM | disk | FTP | other *** search
/ Wayzata's Best of Shareware PC/Windows 2 / Wayzata's Best of Shareware 2.0 (Windows) (Wayzata Technology)(7112)(1994).bin / mac / TWLITE / DOS.TXT < prev    next >
Text File  |  1992-08-25  |  39KB  |  868 lines

  1.  
  2.                Pro Power Tips 1.0A (c) 1992  Scanlon Enterprises
  3.  
  4.         ────────────────────────────────────────────────────────────────
  5.  
  6.                                  DOS POWER TIPS
  7.  
  8.         ────────────────────────────────────────────────────────────────
  9.  
  10.  
  11.  
  12.         Using DOS can sometimes be frustrating, and for some, down right 
  13.         impossible. This section is devoted to aiding you in working 
  14.         with DOS and in utilizing the full potential of DOS and it's 
  15.         environment.
  16.  
  17.  
  18.  
  19.  
  20.         Getting More Memory From DOS
  21.  
  22.         Would you like more memory for your application(s)? Beginning 
  23.         with DOS 5.0, Microsoft is allowing users with extended memory 
  24.         (286 systems and up), to place much of the DOS operating system 
  25.         into high memory. By adding a couple of lines to your CONFIG.SYS 
  26.         file, you can have a conventional memory size report from MEM 
  27.         like this :
  28.  
  29.             655360 bytes total conventional memory
  30.             655360 bytes available to MS-DOS
  31.             617520 largest executable program size
  32.  
  33.         On a 386 machine, you get even more. Just start your CONFIG.SYS 
  34.         file with these lines :
  35.  
  36.         DOS=HIGH
  37.         device=C:\UTILS\TSR1\himem.sys
  38.  
  39.         Now your application can have over 617K of ram!
  40.  
  41.  
  42.  
  43.  
  44.         Smoother DOS
  45.  
  46.         I have noticed on many client machines, the trend to clump many 
  47.         files into the ROOT directory of the boot drive (usually C:). 
  48.         Not only does this slow DOS down, but it could be the potential 
  49.         for some real problems. On floppies, there is a limit of 112 
  50.         files for a root directory. This means, that when there are 112 
  51.         files, DOS will give an error report, of "unable to create file" 
  52.         on the next attempt to create a file, even temporary files, 
  53.         which many word processors need. In fact, there are many 
  54.         applications which create temporary files in the root directory. 
  55.         If you keep adding files to the root (other than these temporary 
  56.         ones), then eventually, the application itself will fail! I 
  57.         suggest, as an experienced consultant, that you create and 
  58.         maintain several directories, including layered ones.
  59.  
  60.         For instance, ALL DOS programs, should go into a directory 
  61.         called DOS, just off the root. The only files DOS needs in the 
  62.         root at boot time, are COMMAND.COM and CONFIG.SYS ! Everything 
  63.         else, including your mouse drive and ANSI.SYS should be in a 
  64.         directory. Another directory you should create, is one called 
  65.         BAT (or BATCH), where you should place all those short batch 
  66.         files (they don't belong in the root directory). There is only 
  67.  
  68.         one batch file which should be in the root, and that is 
  69.         AUTOEXEC.BAT!
  70.  
  71.         What of layered directories ? If like me, you collect utilities, 
  72.         then you should keep those most often used in one directory and 
  73.         the rest in another, and NOT in the root directory! A layered 
  74.         directory is one which is inside another. For instance, on my 
  75.         machine, I created a directory called UTILS, which itself, 
  76.         contains only other directory names. Inside UTILS, I created 
  77.         directories with names of L1, L2, L3, etc... and each one has 
  78.         utilities, which are of lesser and lesser importance, with L1 
  79.         containing the most often used.
  80.  
  81.         Why this struggle to remove files from the root and use of 
  82.         layered directories? Because, DOS must search for whatever you 
  83.         type at a DOS prompt, or what is requested from a batch file. 
  84.         DOS will search a 10 entry directory faster than a 100 entry 
  85.         directory! You WILL notice this extra speed! The layered 
  86.         directories adds to this approach. When you made your AUTOEXEC 
  87.         batch file, you added a line starting with "PATH=", which 
  88.         contains the search string for DOS. This search string tells DOS 
  89.         where to begin looking for executable programs, after checking 
  90.         the current directory. For this reason, I place my DOS directory 
  91.         as the first search entry like this : PATH=C:\DOS
  92.  
  93.         If all of your executables were in this one directory, that 
  94.         would be all you needed! This would be the case for small hard 
  95.         drives, such as the old 10MB and 20MB drives. This is NOT the 
  96.         case for systems with dozens of applications, which can be 
  97.         executed from any DOS prompt. In my case, for example, I created 
  98.         the extra utility directories inside a main directory called 
  99.         UTILS, with the names of L1, L2, L3, etc.. In this case, my PATH 
  100.         statement, in my AUTOEXEC has the following PATH statement:
  101.  
  102.                 PATH=C:\DOS;C:\UTILS\L1;C:\UTILS\L2;C:\UTILS\L3
  103.  
  104.         We prefix the path, with a drive letter, because, we might be on 
  105.         drive A or B when we request a utility or DOS function. Notice 
  106.         the semicolon between entries. DOS requires these to delimit one 
  107.         path entry from another. A well designed hard drive, will have 
  108.         less than 20 entries in the root directory!
  109.  
  110.  
  111.  
  112.         Easy Disk Transfer
  113.  
  114.         Add the following two batch files to your system to make copying 
  115.         files from drive A to your hard drive easy. The batch file 
  116.         TOA.BAT copies selected (or all) files to drive A, while the 
  117.         batch file FROMA.BAT copies selected (or all) files from drive 
  118.         A. By using these two batch files, you can avoid have to retype 
  119.         and retype the DOS COPY command.
  120.  
  121.                 TOA.BAT
  122.  
  123.                 REM ------------------
  124.                 REM -   TOA.BAT      -
  125.                 REM ------------------
  126.                 REM Copy several files to drive A:
  127.                 ECHO OFF
  128.                 IF NOT %1* == * GOTO LPB
  129.                 COPY *.* A:
  130.                 :LPA
  131.                 SHIFT
  132.                 :LPB
  133.                 IF %1* == * GOTO XIT
  134.  
  135.                 COPY %1 A:
  136.                 GOTO LPA
  137.                 :XIT
  138.                 REM End of batch file
  139.  
  140.                 FROMA.BAT
  141.  
  142.                 REM -------------------
  143.                 REM -   FROMA.BAT     -
  144.                 REM -------------------
  145.                 REM Copy several files from drive A:
  146.                 ECHO OFF
  147.                 IF NOT %1* == * GOTO LPB
  148.                 COPY A:*.*
  149.                 :LPA
  150.                 SHIFT
  151.                 :LPB
  152.                 IF %1* == * GOTO XIT
  153.                 COPY A:%1
  154.                 GOTO LPA
  155.                 :XIT
  156.                 REM End of batch file
  157.  
  158.         Now, if you want to copy, for example, 3 files to drive A:, 
  159.         called MYF1, MYF2 & MYF3 you simply enter :
  160.  
  161.                 TOA MYF1 MYF2 MYF3
  162.  
  163.         If the same files were on A: and you wanted them on C: you'd 
  164.         enter this :
  165.  
  166.                 FROMA MYF1 MYF2 MYF3
  167.  
  168.         These batch files examples can easily be modified to include 
  169.         other drives, such as B: or D: !
  170.  
  171.  
  172.  
  173.         Batch File, Know Thy Self
  174.  
  175.         Do you have a batch file which must be run on drive A: only, 
  176.         such as an INSTALL.BAT file? Add these few lines to your batch 
  177.         file, and it will know if it is running on drive A: (Assume the 
  178.         batch file name is INSTALL.BAT).
  179.  
  180.                 IF NOT %0 == A:INSTALL.BAT GOTO DRVERR
  181.                 {Your batch file commands}
  182.                 GOTO XIT
  183.                 :DRVERR
  184.                 ECHO You must start this batch file from drive A:
  185.                 :XIT
  186.  
  187.         DOS sets batch file %0 equal to the path (including drive) and 
  188.         file name of the current running batch file.
  189.  
  190.  
  191.  
  192.         The Invisible DOS TYPE Command
  193.  
  194.         DOS has several built in commands, one of which is the COPY 
  195.         command. This is normally used, to transfer files from one disk 
  196.         to another. This remarkable utility can also, display or print a 
  197.         file. To print a file, simply use the following:
  198.  
  199.                 COPY filename PRN
  200.  
  201.  
  202.         Where "filename" is any valid DOS file name, which may include 
  203.         drive and path. Alternately, you may substitute LPTn for PRN, 
  204.         where "n" is in the range of 1 - 4 on PC compatible machines and 
  205.         1 - 9 on PS/2 compatible machines. To display a file, simply 
  206.         enter the following :
  207.  
  208.                 COPY filename CON
  209.  
  210.         Where "filename" is the same as above. You will have to be quick 
  211.         to stop the scrolling, as it will scroll off screen, if you do 
  212.         NOT use the PAUSE key to halt it. The advantage of using this 
  213.         approach for printing, is that the DOS redirector ">" does NOT 
  214.         have to be used, as when using the TYPE command, IE.. TYPE 
  215.         filename > PRN . Another advantage of using COPY, is that if you 
  216.         are on a strange machine, and it doesn't have TYPE.COM anywhere 
  217.         around, then you can use COPY as it's a built in DOS function, 
  218.         and does NOT require an external program to execute.
  219.  
  220.  
  221.  
  222.         Use Your Computer as a Typewriter
  223.  
  224.         To type directly from the keyboard to a printer, a quick yet 
  225.         easy way is to use "COPY CON PRN". This is entered directly from 
  226.         a DOS prompt. You won't have word wrap, or other wordprocessor 
  227.         features, but you can correct any text entered on the current 
  228.         line. You simply enter a line of text, and press {Enter} after 
  229.         assuring that the line is correct. Once entered the last line to 
  230.         send to the printer, hold the Control key down and press the "Z" 
  231.         key. Release both keys and press {Enter}. Everything that you 
  232.         have typed will be printed on your printer.
  233.  
  234.  
  235.  
  236.         Protecting System Files From Accidental Deletion
  237.  
  238.         You're working in an application directory on your hard disk 
  239.         with a job running longer than expected. So you decide to make 
  240.         room on a recycled floppy to copy files and finish the project 
  241.         at home. You type "DIR A:" and see that you no longer need the 
  242.         data on the floppy disk, but then you type "DEL *.*", and when 
  243.         DOS asks "Are You Sure (Y/N) ?", you answer "Y", erasing all the 
  244.         files in your application directory! Protect yourself from this 
  245.         type of accidental erasure, by using the DOS command "ATTRIB +R 
  246.         *.*" to make all files in your applications directory read-only. 
  247.         You can un-protect individual files that require regular 
  248.         updating (personal dictionaries and so on) by typing "ATTRIB -R 
  249.         filename".
  250.  
  251.  
  252.  
  253.         Easy On-Line Reminders
  254.  
  255.         If you can't always remember short but complex procedures and 
  256.         command sequences (printer setup codes and the like), jog your 
  257.         memory with brief, on-line ASCII how-to files created with your 
  258.         text editor or word processor. Format the files so that they're 
  259.         easily readable in a single screen. Give them names you'll have 
  260.         no trouble remembering, and store them in a directory call 
  261.         "\HELP". Then add a batch file called "HELP.BAT", which contains 
  262.         the line "TYPE \HELP\%1", to your batch file directory, which is 
  263.         contained in the PATH statement, of your AUTOEXEC.BAT file. When 
  264.         you need assistance, use the DOS command "HELP filename" to get 
  265.         an instant refresher course.
  266.  
  267.  
  268.  
  269.  
  270.         Determining Your Rom Bios Date
  271.  
  272.         If you are experiencing problems with a hardware upgrade, you 
  273.         can use the DEBUG utility (which came on one of your DOS disks) 
  274.         to check the date of your computer's Rom Bios. Run DEBUG, and at 
  275.         the hyphen "-" prompt type DFFFF:5 L8 and press {Enter}. Your 
  276.         system's Rom Bios Date will appear on the right side of your 
  277.         screen. Press Q then {Enter} to return to a DOS prompt.
  278.  
  279.  
  280.  
  281.         A Quicker Exit
  282.  
  283.         If you frequently shell out of applications or an environment, 
  284.         you probably  get plenty of practice typing "EXIT" and pressing 
  285.         {Enter} to return to the application. You can save yourself some 
  286.         keystrokes by creating a batch file called E.BAT that contains 
  287.         the line "EXIT". This batch file should be in a directory listed 
  288.         in the PATH of your system.
  289.  
  290.  
  291.  
  292.         The Shell in the Shell
  293.  
  294.         If the WordPerfect Library shell loads inside of itself, you DOS 
  295.         prompt will read something like "(SHELL)(SHELL)C::>", and {F7} 
  296.         won't bring back the Library screen. To solve the problem, type 
  297.         EXIT and press {Enter}, then press {F7} at the Library screen, 
  298.         repeating the process until your prompt has only one "(SHELL)". 
  299.         To avoid the problem, regularly use {F7} rather than the SHELL 
  300.         command to return to the Library.
  301.  
  302.  
  303.  
  304.         Avoiding Double DOS Prompts
  305.  
  306.         To avoid getting double DOS prompt after executing a batch file, 
  307.         don't end the file with a hard return; just finish typing the 
  308.         last command without pressing <ENTER>, and save the file. If 
  309.         your word processor or text editor adds a carriage return and 
  310.         linefeed anyway, you can use the COPY command to clip it off. 
  311.         First, use EDLIN, any word processor or text editor, that 
  312.         enables you to insert a <ctrl>-Z after the last character of the 
  313.         last command to mark the file's cutoff point. Save the file. At 
  314.         the DOS prompt, type COPY, a space, the batch file name and 
  315.         extension, and then a plus sign "+", and two commas (for example 
  316.         : COPY TEST.BAT+,,), and press <ENTER> to pare off the hard 
  317.         return.
  318.  
  319.  
  320.  
  321.         Where's That Ram
  322.  
  323.         More and more VGA Boards are sporting 512K or more of Ram. But 
  324.         if you check video RAM with the current version of most programs 
  325.         like Chekit, System Sleuth or Norton Utils, they show up to 256K 
  326.         only. Not to worry, the additional Ram is really there, but the 
  327.         BIOS calls (standard) do not yet support for video ram sizes 
  328.         greater than 256K.
  329.  
  330.  
  331.  
  332.         DOS FILES and BUFFERS CONFIG.SYS commands
  333.  
  334.         The CONFIG.SYS file, MUST be located in the ROOT directory of 
  335.  
  336.         the boot drive. This file, contains commands to set some DOS 
  337.         resources plus installation of Device Drivers, such as that for 
  338.         the Mouse. By default, DOS reserves small portions of memory to 
  339.         use, to track and manage a number of disk drives, open files, 
  340.         standard devices such as the video and keyboard, and disk data 
  341.         buffers. The FILES command lets you increase the maximum number 
  342.         of simultaneously open files, a necessity of modern applications 
  343.         that open multiple data, index or internal utility (such as a 
  344.         spelling checker) files. In DOS versions prior to 3.3, FILES 
  345.         could NOT be set greater than 20! With newer DOS versions, we 
  346.         can now set FILES to as high as 255! BUFFERS, is a command to 
  347.         enable a selected number of disk buffers, DOS's built in disk 
  348.         cache system. The larger the number of Buffers, the more disk 
  349.         cache available to DOS, and the less memory available to your 
  350.         application program. The ideal setting for FILES, depends on the 
  351.         applications you are running. Many applications, upon 
  352.         installation, modify the CONFIG.SYS file to make FILES the 
  353.         correct size for that application. Other applications, simply 
  354.         warn the user to have FILES set to the correct value. Find the 
  355.         application requesting the largest number of FILES and set FILES 
  356.         to that number, plus 2, for each TSR you may have, which access 
  357.         files. IE.. your word processor wants 20, and you have 3 TSR 
  358.         programs running that access files, then set FILES=26 in your 
  359.         CONFIG.SYS file. If you are running DOS versions prior to 3.3, 
  360.         there are some Shareware utilities which can set the max FILES 
  361.         to larger than the DOS limit of 20!  The BUFFERS command sets up 
  362.         the DOS internal buffers, which hold copies of recent disk I/O. 
  363.         Whenever an application wants to read or write data to a disk, 
  364.         DOS first checks the disk buffers to see if the requested data 
  365.         is there. If the data is, then disk I/O is NOT necessary. This 
  366.         speeds up your application.  Of course, having too many BUFFERS 
  367.         can slow things down, as this would mean more searching. The 
  368.         optimum number of BUFFERS depends in part upon the 
  369.         characteristics and types of drives on you system, the 
  370.         application types and  number of directories and sub-
  371.         directories. For example, having a large number of buffers does 
  372.         NOT improve performance of applications that access files 
  373.         sequentially, but can dramatically reduce the execution time of 
  374.         programs that access files randomly, especially files with small 
  375.         record sizes, such as an index file. Increasing BUFFERS is also 
  376.         useful for systems with layered directories (several layers). If 
  377.         you are, however, using a disk cache system, then you should set 
  378.         BUFFERS=1 (see your cache system manual).
  379.  
  380.  
  381.  
  382.         ATTRIB to the Rescue!
  383.  
  384.         You can find files with the DOS ATTRIB command just as easily as 
  385.         using the program WHEREIS! Simply enter "ATTRIB *.TXT /S" will 
  386.         find all TXT extension files, listing them to the display. Want 
  387.         a listing ? Then use "ATTRIB *.TXT /S>TXT.LST" will put the 
  388.         listing into the file "TXT.LST".
  389.  
  390.         Another useful use of ATTRIB, is to force programs which will 
  391.         not accept will cards, to perform their task over a range of 
  392.         several files, without having to enter each one manually. We can 
  393.         do this across directories. First, we must set the archive bit 
  394.         on all files we want to perform a task on. Do this with the 
  395.         command "ATTRIB +A *.TXT /S". Next, rename the program that you 
  396.         want to operate on all the selected files, in our example, we 
  397.         will use POWER.COM, to A.extension (our example is A.COM). Now, 
  398.         use attrib to make a batch file, like so, "ATTRIB *.TXT 
  399.         /S>OPT.BAT". The batch file thus created, will contain a list of 
  400.         each TXT extension file, preceded by A, such as "A 
  401.         C:\MYTXT.TXT". Now executing the batch file will cause our 
  402.  
  403.         program POWER.COM, renamed to A.COM, to operate on all TXT 
  404.         extension files!
  405.  
  406.  
  407.  
  408.         A Different DOS Backup System, for FREE
  409.  
  410.         You can use the DOS ATTRIB and XCOPY to make a very powerful 
  411.         back up system. The DOS BACKUP command, is know as having many 
  412.         bugs and restore problems, especially if restoring between DOS 
  413.         versions. To back up your system for the first time, use the 
  414.         following ATTRIB command line.
  415.  
  416.                 ATTRIB +A *.* /S
  417.  
  418.         This will SET all file archive flags, in all directories of the 
  419.         current drive. We can now begin the backing up all files. First, 
  420.         have a stack of formatted disks ready for you backup. For 40 
  421.         megabytes of data, you will need; 110 360K disks, 33 1.2Meg 
  422.         disks, 55 720K disks or 28 1.44meg disks. Now, at your DOS 
  423.         prompt, enter the following command line.
  424.  
  425.                 XCOPY *.* A: /A /S /E
  426.  
  427.         This will fill the first disk and exit with a "Disk Full" 
  428.         message. Simply ignore the error, and replace the full disk, 
  429.         with an empty one, press the [F3] key to duplicate the previous 
  430.         command (or retype it), and repeat this process, until there are 
  431.         no files to copy. After making this initial set, you will only 
  432.         need to back up new or modified files. Doing this, simply 
  433.         requires you to have enough formatted disk ready to copy the new 
  434.         data (usually one disk is enough). Now type the line beginning 
  435.         with "XCOPY" from above, and all NEW files will be cloned on 
  436.         your disk. Using this process, also makes the directories on the 
  437.         floppy as it goes, including empty ones. The only draw back to 
  438.         this method, is attempting to back up files larger than the 
  439.         selected disk size. IE... a 360K disk will only hold a file up 
  440.         to 360K in size.
  441.  
  442.  
  443.  
  444.         Stop Struggling With The DOS Format Command
  445.  
  446.         Do you often format different density disks in the same drive? 
  447.         Here is a quick batch file, which will save you keystrokes.
  448.  
  449.         @ECHO OFF
  450.         REM FORMAT.BAT
  451.         REM RENAME THE DOS FORMAT.COM TO FORMAT!.COM
  452.         GOTO %1
  453.         :HELP
  454.         ECHO You must specify the type of disk you want to format
  455.         ECHO FORMAT 360 will format a 360K disk in drive A:
  456.         ECHO FORMAT 12 will format a 1.2MB disk in drive A:
  457.         ECHO FORMAT 720 will format a 720K disk in drive B:
  458.         ECHO FORMAT 144 will format a 1.44MB disk in drive B:
  459.         ECHO Do NOT include the drive letter
  460.         ECHO Other FORMAT options are OK
  461.         GOTO DONE
  462.         :360
  463.         FORMAT! A: /N:09 /T:40 %2 %3 %4
  464.         GOTO DONE
  465.         :12
  466.         FORMAT! A: /N:15 /T:80 %2 %3 %4
  467.         GOTO DONE
  468.         :720
  469.  
  470.         FORMAT! B: /N:09 /T:80 %2 %3 %4
  471.         GOTO DONE
  472.         :144
  473.         FORMAT! B: /N:15 /T:80 %2 %3 %4
  474.         GOTO DONE
  475.         :DONE
  476.  
  477.         If your drives are different that the above, simply edit the 
  478.         lines, to the correct drive letter. Remember, 5¼ inch drives are 
  479.         360K and 1.2MB while 3½ inch drives are 720K and 1.44MB. Thus, 
  480.         if your drive A: is 3½ instead of B:, then simply change the 
  481.         above A:'s to B:'s and B:'s to A:'s !
  482.  
  483.  
  484.  
  485.         FREE File Viewer From DOS
  486.  
  487.         If you want a FREE file viewing utility, you have one already! 
  488.         Many of you already are aware of using the good old line of
  489.  
  490.                 TYPE filename | MORE
  491.  
  492.         Save your self some typing and create the following one line 
  493.         batch file calling it TYP.BAT
  494.  
  495.                 MORE < %1
  496.  
  497.         This results in the same output as the earlier one using the DOS 
  498.         command TYPE! The %1 will be replaced at execution time, by the 
  499.         specified file name, such as TYP MYFILE ! Of course, this 
  500.         feature does NOT support paging or scrolling features found in 
  501.         many good FileListing utilities. However, if you're just 
  502.         interested in viewing a file to see if it's worth keeping or 
  503.         printing this is fast and easy to use. To abort the scrolling, 
  504.         simply press <Ctrl>C or <Ctrl><Break>! To move from to the next 
  505.         video page, press any key!
  506.  
  507.  
  508.  
  509.         A No Text Editor Method of Creating Short Batch Files
  510.  
  511.         Need to create a one line or short batch file? You don't even 
  512.         need to start your text editor or word processor. At a DOS 
  513.         prompt, enter the following single line:
  514.  
  515.         COPY CON filename
  516.  
  517.         Replace "filename", with the name of the file you want to 
  518.         create. Press <ENTER> after "filename". The cursor will be 
  519.         located to the next line, and you begin entering keystrokes just 
  520.         as though you were using a text editor. You will NOT be able to 
  521.         edit a previous line (you can't cursor up). Once you are though, 
  522.         all text lines entered, press <F6> <ENTER>. You will get a DOS 
  523.         prompt back.
  524.  
  525.  
  526.  
  527.         Glean More Ram For Your Applications
  528.  
  529.         Here's a way to save 1K or more of application ram, if you are 
  530.         loading TSR's into ram from your AUTOEXEC batch file. The trick, 
  531.         is to arrange you startup commands efficiently. Put DOS commands 
  532.         that don't increase the size of the environment, such as CHKDSK, 
  533.         ECHO and BREAK at the beginning of AUTOEXEC. Now load your TSR 
  534.         applications, making sure to include the path names. This is 
  535.         done prior to setting the path or other environ variables such 
  536.  
  537.         as COMSPEC. After loading your TSR's you can execute any command 
  538.         which will increase the environ size, such as PATH and PROMPT.
  539.  
  540.         The reason we can gain memory in this manner, is because each 
  541.         time an application is loaded, DOS gives the application a COPY 
  542.         of the ENVIRON area, which includes PATH settings, etc... If we 
  543.         start our TSR's prior to setting any ENVIRON variables, we will 
  544.         give a TSR a smaller ENVIRON area! In this way, if your ENVIRON 
  545.         space uses 200 bytes and you have 5 TSR applications you'll save 
  546.         1K byte!
  547.  
  548.  
  549.  
  550.         FOR POWER!
  551.  
  552.         The DOS batch command FOR, can invoke several commands on a 
  553.         single line, to speed up your batch files. Consider an AUTOEXEC 
  554.         batch file that has the following 3 lines.
  555.  
  556.                 PROMPT=$P$G
  557.                 TSR1
  558.                 TSR2
  559.  
  560.         DOS must access the disk 3 times to read those 3 commands. 
  561.         Instead, pack all 3 commands into 1 line, using FOR :
  562.  
  563.                 FOR %%F IN (PROMPT=$P$G TSR1 TSR2) DO %%F
  564.  
  565.         This single line batch command replaces the previous 3 lines! In 
  566.         this case, the FOR command takes each entry (space delimited) 
  567.         and substitutes them for the variable %%F. In this way, DOS will 
  568.         only need to access the disk 1 time to read the 3 commands, 
  569.         instead of the previous 3 times! The one restriction with this 
  570.         tip is that programs executed in this fashion, can NOT have an 
  571.         argument passed to them. Also, the FOR command interprets 
  572.         semicolons as delimiters, just as it does spaces, so, you can 
  573.         NOT include your PATH command in a FOR command.
  574.  
  575.  
  576.  
  577.         Batch Files That Count
  578.  
  579.         Use this counting routine in batch files to perform routine 
  580.         tasks, such as backups, that you want to execute at regular 
  581.         intervals. The batch file COUNT.BAT, for example, used in your 
  582.         AUTOEXEC.BAT file, will automatically run CHKDSK /F command 
  583.         every third time you reboot. COUNT.BAT creates a zero byte file 
  584.         and uses its name as the counter. Create the batch file, 
  585.         COUNT.BAT, then add the line CALL COUNT.BAT to your AUTOEXEC.BAT 
  586.         file.
  587.  
  588.                 ECHO OFF
  589.                 CLS
  590.                 IF NOT EXIST BOOT? GOTO NO
  591.                 FOR %%F IN (BOOT3 BOOT2 BOOT1) DO IF EXIST %%F GOTO %%F
  592.                 GOTO ERROR
  593.                 :NO
  594.                 TYPE >BOOT2
  595.                 GOTO END
  596.                 :BOOT3
  597.                 REN BOOT3 BOOT1
  598.                 CHKDSK /F
  599.                 GOTO END
  600.                 :BOOT2
  601.                 REN BOOT2 BOOT3
  602.                 GOTO END
  603.  
  604.                 :BOOT1
  605.                 REN BOOT1 BOOT2
  606.                 GOTO END
  607.                 :ERROR
  608.                 ECHO A BOOT file already exists, please delete
  609.                 ECHO it and retry.
  610.                 :END
  611.  
  612.         When you execute COUNT.BAT, it checks for a file named BOOT? and 
  613.         branches to a label in the batch file, although most of the 
  614.         branching simply renames the BOOT? file to the next level, thus 
  615.         incrementing the counter. In the first pass, the BOOT2 file is 
  616.         created via the instructions at label NO. We make an initial 
  617.         file of BOOT2 because this will have been the first pass. Each 
  618.         additional pass thru the batch file, causes a high numbered 
  619.         BOOT? file to be created, by renaming a previous level. If 
  620.         during the first pass, a BOOT? file is discovered, other than 
  621.         the 3 BOOT? files we want, we branch to the ERROR label and 
  622.         instruct the user to delete it. You can perform tests on as many 
  623.         different branches as you wish. For example, you might count to 
  624.         10, running CHKDSK /F on count 5 and a back up on count 10. Just 
  625.         add additional BOOT? names in the line beginning with FOR, and 
  626.         additional labels after BOOT3 for the additional BOOT? 
  627.         functions. NOTE, the COUNT.BAT file is in the root directory 
  628.         with AUTOEXEC.BAT and BOOT? files.
  629.  
  630.  
  631.  
  632.         DOS 5.0 CHKDSK Meanings
  633.  
  634.         Many users are confused by the DOS 5.0 CHKDSK display. The 
  635.         following is a DOS 5.0 CHKDSK report for a PC with a 40MB hard 
  636.         drive, along with the meaning.
  637.  
  638.         33462272 bytes total disk space
  639.         57344 bytes in 5 hidden files    ────────┤ Hard disk space
  640.         172032 bytes in 74 directories           │ utilization in
  641.         29212672 bytes in 4921 user files        │ bytes
  642.         3975168 bytes available on disk
  643.  
  644.                                                  │ Disk space allocation
  645.                                                  │ units. An allocation
  646.                                                  │ unit is a group of
  647.         2048 bytes in each allocation unit  ─────┤ sectors that DOS
  648.         16339 total allocation units on dis      │ treats as a single
  649.         1941 available allocation units on disk  │ block. It represents
  650.                                                  │ the least amount of
  651.                                                  │ disk space DOS will
  652.                                                  │ allocate to a file.
  653.  
  654.                                                  │ Amount of convention-
  655.         655360 total bytes memory  ──────────────┤ al memory installed 
  656.         511984 bytes free                        │ and available. This
  657.                                                  │ memory is different
  658.                                                  │ from hard disk memory
  659.                                                  │ reported above.
  660.  
  661.         Allocation units are also called CLUSTERS.
  662.  
  663.         A hard drive is much like a floppy disk, except it can hold much 
  664.         more data, and can NOT be removed like a floppy. In addition, a 
  665.         hard is accessed faster than a floppy. RAM, is temporary 
  666.         storage, inside the computer, and goes away each time power is 
  667.         turned off, and must be restored each time your computer is 
  668.         turned back on. This process is called booting.
  669.  
  670.  
  671.  
  672.  
  673.         Emergency Disks
  674.  
  675.         If you are backing up your system regularly, the following 
  676.         information will aid in getting you back up and running quickly. 
  677.         You will need to make a DOS boot disk (if you have an older 
  678.         machine it will be a 360K disk). To make a boot disk, place a 
  679.         new (un-formatted) disk, into drive A: and type "FORMAT A: /S" 
  680.         at your DOS prompt. This will create a bootable disk, with the 
  681.         DOS operating system on it. Now, put the following DOS utilities 
  682.         on this disk :
  683.  
  684.                 FDISK.EXE
  685.                 FORMAT.COM
  686.                 DEBUG.COM   (XT machines only)
  687.  
  688.         If the disk has room, place a copy of your backup program onto 
  689.         the disk (or just the restore portion). If your backup program 
  690.         will NOT fit onto this disk, then you will have to put it onto a 
  691.         separate disk. You might read your back up disk documentation to 
  692.         see if it suggests how to make an emergency restoral disk. Next, 
  693.         you will need a low level formatting program, such as Disk 
  694.         Manager, or for XT machines, you will need to place the DOS 
  695.         DEBUG.COM program on the emergency disk. Mark the disk(s), 
  696.         "Emergency Boot Disk(s)". Now, when your hard drive fails (all 
  697.         eventually do), you'll be able to restore the system. Simply 
  698.         repair or replace the hard drive, pull out your back up disks 
  699.         from your last backup and do the following.
  700.  
  701.                 1) Boot your system from the "Emergency Boot Disk"
  702.                 2) Start the lowlevel formatting program
  703.                 3) Run FDISK to partition the drive
  704.                 4) Run Format to format the drive
  705.                 5) Run your backup programs restore file option
  706.  
  707.         If you are restoring an XT, then replace step two above with :
  708.  
  709.                 2) Start DEBUG, and enter GC800:5 at the "-" prompt
  710.  
  711.         This will lowlevel format an XT machine.
  712.  
  713.         If you backup regularly, getting things going will be much 
  714.         faster and easier than with out regular backups. If you are 
  715.         attempting to restore you system without a backup set, you'll 
  716.         have to have original disks for each application and reinstall 
  717.         each! If you had data, on the broken drive, which must be 
  718.         recovered, you'll have to lay out a big chunk of money to a data 
  719.         recovery service to get the data off the broken drive (and there 
  720.         are NO guarantees the data can all be recovered). By backing up 
  721.         regularly, you need only perform the above 5 steps, with a time 
  722.         of around 2 hours to several hours. If you don't, it may take 
  723.         you months to recover the data you lost!
  724.  
  725.  
  726.  
  727.         Directory Navigation Shortcuts
  728.  
  729.         Save yourself time and keystrokes, by using these directory 
  730.         navigation shortcuts.
  731.  
  732.         If you are in a directory \WP\FILES and wish to go to \WP\DOCS 
  733.         you'd type these lines.
  734.  
  735.                 CD \
  736.                 CD WP
  737.  
  738.                 CD DOCS
  739.  
  740.         These three lines can be replaced with one:
  741.  
  742.                 CD ..\DOCS
  743.  
  744.         DOS supplies us with a directory entry "..", which references 
  745.         the previous directory level. By Type "CD .." we go back one 
  746.         level. By adding the "\DOCS" to the tail of this string, we can 
  747.         navigate the entire change in one command. First, DOS moves back 
  748.         the one level (now in \WP), then DOS moves forward one level to 
  749.         the directory DOCS (now in \WP\DOCS).
  750.  
  751.         Another interesting aspect of this function is in navigating 
  752.         multi-level directories. If you are in the following directory :
  753.  
  754.         \WORD\FILES\LETTERS\APRIL
  755.  
  756.         And wanted to go to the directory \WORD\FILES, you'd normally 
  757.         type two lines : 
  758.  
  759.                 CD \
  760.                 CD WORD\FILES
  761.  
  762.         Or even the single line "CD \WORD\FILES" to combine the two 
  763.         commands into one. There is a shorter way, simply type the 
  764.         following : CD ..\..     You're there !
  765.  
  766.  
  767.  
  768.         Batch File CALLS Using DOS Before Version 3.3
  769.  
  770.         In DOS 3.3 and up, there is a new command "CALL", which will 
  771.         execute another batch file, then return to the original batch 
  772.         file, starting at the line after the "CALL". For instance :
  773.  
  774.                 ECHO OFF
  775.                 CLS
  776.                 CALL AUTO
  777.                 MENU
  778.  
  779.         Would call the batch file "AUTO", then return an start a MENU. 
  780.         This function can be emulated using earlier DOS versions, and 
  781.         without executing another COMMAND.COM shell! To do this involves 
  782.         a little forethought and planning. Taking the above example, we 
  783.         create a batch file, adding a couple of lines.
  784.  
  785.                 ECHO OFF
  786.                 IF %RETURN%*==* GOTO START
  787.                 GOTO %RETURN%
  788.                 :START
  789.                 CLS
  790.                 SET RETURN=RETURN
  791.                 AUTO AUTOEXEC
  792.                 :RETURN
  793.                 MENU
  794.  
  795.         After our ECHO OFF (halt echoing), we check to see if the 
  796.         variable (DOS Environ) is set, and if so we assume it is set to 
  797.         a label in the current batch file, AUTOEXEC. If there is NOT a 
  798.         label, we branch to the normal entry and clear the display. 
  799.         However, if RETURN has a value, we branch to that label, 
  800.         assuming the label is in the current batch file AUTOEXEC. After 
  801.         clearing the screen, we set our return label to RETURN and start 
  802.         the AUTO batch file.
  803.  
  804.  
  805.         The batch file AUTO will then have these lines:
  806.  
  807.                 {your batch file commands}
  808.                 %1%
  809.  
  810.         The last line, returns control to the original batch file. The 
  811.         AUTOEXEC after AUTO in our first batch file, is will replace the 
  812.         %1 parameter ! When we return, we will automatically return to 
  813.         the label "RETURN" in the first batch file, then we can start 
  814.         the menu.
  815.  
  816.  
  817.  
  818.         Nested Batch Files Save Time
  819.  
  820.         If you want to beef up your batch files, use the DOS COMMAND /C 
  821.         and CALL commands, to create nested batch files that call up one 
  822.         batch file from within another. Without these commands, an 
  823.         executing batch file that summons another will execute the 
  824.         second file and return to a DOS prompt, without completing the 
  825.         original batch file. With DOS 3.3 and higher, CALL, an internal 
  826.         command, can be used to invoke a second batch file, like this :
  827.  
  828.                 DATE
  829.                 CALL TELECOM
  830.                 WP
  831.  
  832.         In this example, which loads a communications program, then a 
  833.         wordprocessor, the CALL command invokes the TELECOM batch file 
  834.         and returns control to the original batch file, which then 
  835.         executes the WP command. If you are using DOS earlier than 3.3, 
  836.         then a different method must be used. The following batch 
  837.         example will perform as the above, for DOS versions earlier than 
  838.         3.3 :
  839.  
  840.                 DATE
  841.                 COMMAND /C TELECOM
  842.                 WP
  843.  
  844.         This approach does have disadvantages. Unlike the DOS 3.3+ call 
  845.         command, COMMAND /C loads another copy of COMMAND.COM to execute 
  846.         the second batch file. When COMMAND.COM terminates, it passes 
  847.         control back to the first batch file, which then executes the 
  848.         final instruction WP. Because each nested batch file has it's 
  849.         own copy of COMMAND.COM , memory usage will be high, and the 
  850.         number of nested calls will be much less than later DOS versions 
  851.         with the CALL command. You can use the CALL and COMMAND /C 
  852.         approach, even from an AUTOEXEC batch file.
  853.  
  854.  
  855.  
  856.         Section finished. Be sure to order your THREE BONUS DISKS which 
  857.         expand this software package with vital tools, updates and 
  858.         additional tutorial material for computer users! Send $24.95 to 
  859.         Scanlon Enterprises, Department TIP, 38354 17th St. E., 
  860.         Palmdale, CA 93550. Bonus disks shipped promptly! Modifications, 
  861.         custom program versions, Site and LAN licenses of this package 
  862.         for business or corporate use are possible, contact the author. 
  863.         This software is shareware - an honor system which means TRY 
  864.         BEFORE YOU BUY. Press escape key to return to menu. 
  865.  
  866.  
  867.  
  868.